package com.gegong.vmware.workstation.service;

import com.gegong.vmware.workstation.CopyVmRequestParameter;
import com.gegong.vmware.workstation.VMInformation;
import com.gegong.vmware.workstation.exceptions.VMwareWorkstationManagementException;
import com.gegong.vmware.workstation.VirtualMachine;

import java.util.List;


/**
 * 虚拟机管理
 *
 * @author dongjak
 * @version 1.0
 */
public interface VMManagementService extends VMwareWorkstationManagementService {


    /**
     * 根据id查找指定的虚拟机
     *
     * @param vmId
     * @return
     * @throws VMwareWorkstationManagementException
     */
    VirtualMachine findById(String vmId) throws VMwareWorkstationManagementException;

    /**
     * 根据名称查找指定的虚拟机
     *
     * @param vmName
     * @return
     * @throws VMwareWorkstationManagementException
     * @deprecated 通过读取vmx文件来实现, 以后官方的rest api支持后会重写该实现
     */
    VirtualMachine findByName(String vmName) throws VMwareWorkstationManagementException;

    /**
     * 获取主机上所有的虚拟机
     *
     * @return
     */
    List<VirtualMachine> findAll() throws VMwareWorkstationManagementException;


    /**
     * 复制虚拟机
     *
     * @return {@link VMInformation}
     */
    VMInformation copyVm(CopyVmRequestParameter parameter) throws VMwareWorkstationManagementException;


    /**
     * 删除虚拟机
     *
     * @param id
     */
    void deleteVm(String id) throws VMwareWorkstationManagementException;


    /**
     * 根据虚拟机id获取对应的虚拟机名称
     *
     * @param vmId
     * @return
     * @deprecated 通过读取vmx文件来实现, 以后官方的rest api支持后会重写该实现
     */
    String getVmNameById(String vmId) throws VMwareWorkstationManagementException;

}
